package com.expression.uartagent.entity;

import com.expression.uartagent.entity.*;

/**
 * Copyright (c) 2017, SuZhou CsjBot. All Rights Reserved.
 * www.csjbot.com
 * <p>
 * Created by 浦耀宗 at 2017/02/09 0009-10:56.
 * Email: puyz@csjbot.com
 */

public class UartPacketExpression implements com.expression.uartagent.entity.PacketExpression {

    byte compression = 0;

    public UartPacketExpression(int compression) {
        this.compression = (byte) (compression + (byte)0x30);
    }

    /**
     * 数据包编码成byte数组
     *
     * @return btye数组
     * @throws com.expression.uartagent.entity.RosConnectException 抛出 RosConnectException异常
     */
    @Override
    public byte[] encodeBytes() {
        return new byte[]{ compression};
    }

    /**
     * 从byte数组解码数据包
     *
     * @param rawData 原始byte数组
     * @return 解码包
     * @throws com.expression.uartagent.entity.RosConnectException 抛出 RosConnectException异常
     */
    @Override
    public com.expression.uartagent.entity.PacketExpression decodeBytes(byte[] rawData) {
        return this;
    }
}
